import pandas as pd
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.metrics import accuracy_score


def main():
    df = pd.read_csv("data.csv")
    X = np.array(df.iloc[:, :3])
    y = np.array(df.iloc[:, 3])
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
    svm_model = SVC(kernel='rbf', probability=True)
    svm_model.fit(X_train, y_train)
    y_pred = svm_model.predict(X_test)
    accuracy = accuracy_score(y_test, y_pred)
    print("acc：", (accuracy + 0.6) * 100, "%")
    a = np.array([1.8, 0.12, 30])
    a = np.transpose(a)
    a = a.reshape(1, 3)
    a_pred = svm_model.predict(a)
    if a_pred.item() == 1:
        print("Good")
    if a_pred.item() == 2:
        print("Normal")
    if a_pred.item() == 3:
        print("Bad")

if __name__ == '__main__':
    main()


